<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>大小写转换</title>
</head>
<body>
    <script>
        //将首字母转大写

        var str = 'hello';
        //第一步：找到首字母
        var fristStr = str.charAt(0);
        //第二步：将首字母转大写
        var fristUpper = fristStr.toUpperCase();
        //第三步：将首字母替换成大写
        var strEnd = str.replace(fristStr,fristUpper)

        console.log(strEnd);
    </script>
</body>
</html>